<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>更新教师</title>
    <!-- 可选的样式表链接 -->
    <link rel="stylesheet" type="text/css" href="/css/styles.css" />
</head>
<body>
<h2>更新教师</h2>
<form th:action="@{/teacher/updateTeacher}" th:object="${teacher}" method="post">
    <!-- 课程号，由模型传递并预填充 -->
    <div>
        <label for="tno">教师号</label>
        <input type="text" id="tno" th:field="*{tno}" th:readonly="true" required />
        <!-- 假设 Teacher 类的属性名为 id，且为不可修改 -->
        <span th:if="${#fields.hasErrors('tno')}" th:errors="*{tno}"></span>
    </div>

    <!-- 课程名称 -->
    <div>
        <label for="tname">姓名</label>
        <input type="text" id="tname" th:field="*{tname}" required />
        <span th:if="${#fields.hasErrors('tname')}" th:errors="*{tname}"></span>
    </div>

    <div>
        <label for="tsex">性别</label>
        <input type="text" id="tsex" th:field="*{tsex}" required />
        <span th:if="${#fields.hasErrors('tsex')}" th:errors="*{tsex}"></span>
    </div>
    <div>
        <label for="cno">课程号</label>
        <select id="cno" name="cno">
            <option th:each="course : ${courseList}" th:value="${course.cno}" th:text="${course.cno}"></option>
        </select><br>
    </div>
    <div>
        <label for="tdept">系</label>
        <input type="text" id="tdept" th:field="*{tdept}" required />
        <span th:if="${#fields.hasErrors('tdept')}" th:errors="*{tdept}"></span>
    </div>

    <!-- 提交按钮 -->
    <div>
        <button type="submit">提交</button>
    </div>
</form>
</body>
</html>